from flask import Flask
from flask_cors import CORS


def create_app():
    app = Flask(__name__, template_folder='../../frontend/templates')
    CORS(app, resources={r"/api/*": {"origins": "http://localhost:8081"}})  # 解决跨域问题
    app.config.from_object('config.Config')
    from .routes import bp as routes_bp
    app.register_blueprint(routes_bp)
    return app
